cmake_minimum_required(VERSION 3.8)
project(village_wang)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()


# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)

find_package(OpenCV REQUIRED)

include_directories(${OpenCV_INCLUDE_DIRS})


if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # comment the line when a copyright and license is added to all source files
  set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # comment the line when this package is in a git repo and when
  # a copyright and license is added to all source files
  set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()

add_executable(wang1_node src/wang1.cpp)
ament_target_dependencies(wang1_node rclcpp)

add_executable(wang2_node src/wang2.cpp)
ament_target_dependencies(wang2_node rclcpp)


add_executable(publisher_node src/publisher.cpp)
ament_target_dependencies(publisher_node rclcpp)
target_link_libraries(publisher_node ${OpenCV_LIBS})


add_executable(subscriber_node src/subscriber.cpp)
ament_target_dependencies(subscriber_node rclcpp)


# Task 1: 视频读取和帧率显示
add_executable(task1 src/task1_video_fps.cpp)
target_link_libraries(task1 ${OpenCV_LIBS})


install(TARGETS
  wang1_node
  wang2_node
  publisher_node
  subscriber_node
  DESTINATION lib/${PROJECT_NAME}
)


ament_package()
